// @ts-ignore
import { request } from '@umijs/max';

// 公文类型列表
export async function writing_types(params: any) {
  return request<API.ReqResult>(`/api/writing_types`, {
    method: 'GET',
    params,
  });
}

// 会话列表
export async function writing_sessions(params: any) {
  return request<API.ReqResult>(`/api/writing_sessions`, {
    method: 'GET',
    params,
  });
}
// 删除会话
export async function delete_writing(id: any) {
  return request<API.ReqResult>(`/api/writing_session/${id}`, {
    method: 'DELETE',
  });
}

// 查询单个会话
export async function getWriting(params: any) {
  return request<API.ReqResult>(`/api/writing_session/${params.id}`, {
    method: 'GET',
  });
}
// 查询单个会话所有
export async function getAllWriting(params: any) {
  return request<API.ReqResult>(`/api/writing_session/${params.id}?all=1`, {
    method: 'GET',
  });
}
// 文档详情
export async function getDocumentsDetail(param: any) {
  return request<API.ReqResult>(`/api/documents/${param.id}`, {
    method: 'GET',
  });
}
// 更新选中文章顺序
export async function update_display_order(body: any) {
  return request<API.ReqResult>(`/api/writing_session/update_display_order`, {
    method: 'POST',
    data: body,
  });
}

// 统计
export async function statistics() {
  return request<API.ReqResult>(`/api/brain_space/statistics`, {
    method: 'GET',
  });
}
